<%-- 
    Document   : addAdmin
    Created on : Aug 20, 2012, 2:08:01 PM
    Author     : HungDQ
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"  %>

<div class="section">
    <!--[if !IE]>start title wrapper<![endif]-->
    <div class="title_wrapper">
        <h2>Member ID : <%=request.getParameter("id") %></h2>

        <!--[if !IE]>start section menu<![endif]-->
        <ul class="section_menu">
            <li></li>
            <li><a href="javascript:window.location.href='?option=member';" class="active"><span><span>GO BACK</span></span></a></li>
            <li></li>
            <li></li>
        </ul>
        <!--[if !IE]>end section menu<![endif]-->

        <span class="title_wrapper_left"></span>
        <span class="title_wrapper_right"></span>
    </div>
    <!--[if !IE]>end title wrapper<![endif]-->
    <!--[if !IE]>start section content<![endif]-->
    <div class="section_content">
        <!--[if !IE]>start section content top<![endif]-->
        <div class="sct">
            <div class="sct_left">
                <div class="sct_right">
                    <div class="sct_left">
                        <div class="sct_right">
                            <!--[if !IE]>start forms<![endif]-->
                            <form action="../nvdung/member/update" method="post" class="search_form general_form">
                                <!--[if !IE]>start fieldset<![endif]-->
                                <h3>
                                <%
                                Object message = request.getSession().getAttribute("MESS");
                                if(message != null && !message.equals(""))
                                {
                                    out.println(message.toString());
                                    request.getSession().removeAttribute("MESS");
                                }
                                %>
                                </h3>

                                <%
                                String id = request.getParameter("id");
                                Object objAppCon = application.getAttribute("APP_CONN");
                                if(id == null)
                                {
                                    out.println("<script>window.history.go(-1);</script>");
                                }
                                else
                                {
                                    int _id = 0;
                                    try {
                                        _id = Integer.parseInt(id);
                                    } catch (NumberFormatException ex) {
                                        out.println("<script>window.history.go(-1);</script>");
                                    }
                                    java.sql.Connection connection = (java.sql.Connection)objAppCon;
                                    org.nvdung.db.SqlMember sqlMember = new org.nvdung.db.SqlMember(connection);
                                    org.nvdung.bean.Member cus = null;
                                    cus = sqlMember.getInfomation(_id);
                                    if(cus == null)
                                    {
                                        out.println("<script>window.history.go(-1);</script>");
                                    }
                                    else
                                    {
                                %>
                                <fieldset>
                                    <div class="forms">
                                        <div class="row">
                                            <label>Username (*)</label>
                                            <div class="inputs">
                                                <span class="input_wrapper"><input class="text" value="<%=cus.getUsername() %>" name="username" type="text" /></span>
                                                <input type="hidden" name="id" value="<%=id%>" />
                                            </div>
                                        </div>
                                        <div class="row">
                                            <label>Password (*)</label>
                                            <div class="inputs">
                                                <span class="input_wrapper"><input class="text" name="password" type="password" /></span>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <label>Full-Name (*)</label>
                                            <div class="inputs">
                                                <span class="input_wrapper"><input class="text" value="<%=cus.getFullName() %>" name="fullname" type="text" /></span>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <label>Email (*)</label>
                                            <div class="inputs">
                                                <span class="input_wrapper"><input class="text" value="<%=cus.getEmail() %>" name="email" type="text" /></span>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <label>Gender </label>
                                            <div class="inputs">
                                                <ul class="inline">
                                                    <li><input class="radio" name="gender" value="1" checked type="radio" /> Male</li>
                                                </ul>
                                                <ul class="inline">
                                                        <li><input class="radio" name="gender" <% if(!cus.isGender()) out.println("checked"); %> value="0" type="radio" /> Female</li>
                                                </ul>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <label>Telephone </label>
                                            <div class="inputs">
                                                <span class="input_wrapper"><input class="text" value="<%=cus.getTelephone() %>" name="telephone" type="text" /></span>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <label>Address </label>
                                            <div class="inputs">
                                                <span class="input_wrapper"><input class="text"value="<%=cus.getAddress() %>" name="address" type="text" /></span>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <label>Note </label>
                                            <div class="inputs">
                                                <span class="input_wrapper textarea_wrapper">
                                                    <textarea name="note" rows="" cols="" class="text"><%=cus.getNote() %></textarea>
                                                </span>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <label>Role </label>
                                            <div class="inputs">
                                                <span class="input_wrapper blank">
                                                    <select name="roleID">
                                                    <%
                                                        java.sql.Connection conn = (java.sql.Connection)application.getAttribute("APP_CONN");
                                                        org.nvdung.db.SqlRole sqlRole = new org.nvdung.db.SqlRole(conn);
                                                        java.util.ArrayList<org.nvdung.bean.Role> al = sqlRole.getAllRole();
                                                        for(int i=0;i<al.size();i++)
                                                        {
                                                            org.nvdung.bean.Role r = al.get(i);
                                                    %><option value="<%=r.getRoleID() %>" <% if(cus.getRoleID()==r.getRoleID()) out.println("selected"); %> > <%=r.getRoleName() %> </option><%
                                                        }
                                                    %>
                                                    </select>
                                                </span>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <label>Status </label>
                                            <div class="inputs">
                                                <span class="input_wrapper blank">
                                                    <select name="status">
                                                        <option value="1" selected>Available</option>
                                                        <option value="0" <% if(!cus.isStatus()) out.println("selected"); %> >Inactive</option>
                                                    </select>
                                                </span>
                                            </div>
                                        </div>
                                        <!--[if !IE]>end row<![endif]-->
                                        <!--[if !IE]>start row<![endif]-->
                                        <div class="row">
                                            <div class="buttons">
                                                <ul>
                                                    <li><span class="button send_form_btn"><span><span>SAVE CHANGE</span></span><input name="" type="submit" /></span></li>
                                                    <li><span class="button cancel_btn"><span><span>RESET</span></span><input name="" type="reset" /></span></li>
                                                </ul>
                                            </div>
                                        </div>
                                        <!--[if !IE]>end row<![endif]-->
                                    </div>
                                    <!--[if !IE]>end forms<![endif]-->
                                </fieldset>
                                <%
                                    }
                                }
                                %>
                                <!--[if !IE]>end fieldset<![endif]-->
                            </form>
                            <!--[if !IE]>end forms<![endif]-->
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--[if !IE]>end section content top<![endif]-->
        <!--[if !IE]>start section content bottom<![endif]-->
        <span class="scb"><span class="scb_left"></span><span class="scb_right"></span></span>
        <!--[if !IE]>end section content bottom<![endif]-->

    </div>
    <!--[if !IE]>end section content<![endif]-->
</div>